home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac Interfaces / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  41.6 KB  |  1,217 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3D.h
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.0
  8.  
  9.      Copyright:    © 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3D__
  18. #define __QD3D__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #if TARGET_OS_MAC
  25. #ifndef __MACTYPES__
  26. #include <MacTypes.h>
  27. #endif
  28. #endif  /* TARGET_OS_MAC */
  29.  
  30. #include <stdio.h>
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=power
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. #if PRAGMA_ENUM_ALWAYSINT
  54.     #pragma enumsalwaysint on
  55. #elif PRAGMA_ENUM_OPTIONS
  56.     #pragma option enum=int
  57. #elif PRAGMA_ENUM_PACK
  58.     #if __option(pack_enums)
  59.         #define PRAGMA_ENUM_PACK__QD3D__
  60.     #endif
  61.     #pragma options(!pack_enums)
  62. #endif
  63.  
  64. #if TARGET_OS_MAC
  65. #define OS_MACINTOSH 1
  66. #define OS_WIN32 0
  67. #define OS_UNIX 0
  68. #define OS_NEXT 0
  69. #define WINDOW_SYSTEM_MACINTOSH 1
  70. #define WINDOW_SYSTEM_WIN32 0
  71. #define WINDOW_SYSTEM_X11 0
  72. #define WINDOW_SYSTEM_NEXT 0
  73. #endif  /* TARGET_OS_MAC */
  74.  
  75. #if TARGET_OS_WIN32
  76. #define OS_MACINTOSH 0
  77. #define OS_WIN32 1
  78. #define OS_UNIX 0
  79. #define OS_NEXT 0
  80. #define WINDOW_SYSTEM_MACINTOSH 0
  81. #define WINDOW_SYSTEM_WIN32 1
  82. #define WINDOW_SYSTEM_X11 0
  83. #define WINDOW_SYSTEM_NEXT 0
  84. #endif  /* TARGET_OS_WIN32 */
  85.  
  86. #if TARGET_OS_UNIX
  87. #define OS_MACINTOSH 0
  88. #define OS_WIN32 0
  89. #define WINDOW_SYSTEM_MACINTOSH 0
  90. #define WINDOW_SYSTEM_WIN32 0
  91. #if NeXT
  92. #define OS_UNIX 0
  93. #define OS_NEXT 1
  94. #define WINDOW_SYSTEM_X11 0
  95. #define WINDOW_SYSTEM_NEXT 1
  96. #else
  97. #define OS_UNIX 1
  98. #define OS_NEXT 0
  99. #define WINDOW_SYSTEM_X11 1
  100. #define WINDOW_SYSTEM_NEXT 0
  101. #endif  /* NeXT */
  102.  
  103. #endif  /* TARGET_OS_UNIX */
  104.  
  105.  
  106. /******************************************************************************
  107.  **                                                                             **
  108.  **                                Export Control                                 **
  109.  **                                                                             **
  110.  *****************************************************************************/
  111. #if TARGET_OS_WIN32
  112.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  113.         #define QD3D_EXPORT __declspec( dllexport )     
  114.         #define QD3D_CALL    
  115.         #define QD3D_CALLBACK    
  116.     #else
  117.         #define QD3D_EXPORT __declspec( dllimport )    
  118.         #define QD3D_CALL    __cdecl
  119.         #define QD3D_CALLBACK    __cdecl    
  120.     #endif /* WIN32_EXPORTING */
  121. #else
  122.     #define QD3D_EXPORT
  123.     #define QD3D_CALL    
  124.     #define QD3D_CALLBACK    
  125. #endif  /*  TARGET_OS_WIN32  */
  126.  
  127.  
  128. /******************************************************************************
  129.  **                                                                             **
  130.  **                                NULL definition                                 **
  131.  **                                                                             **
  132.  *****************************************************************************/
  133.  
  134. #ifndef NULL
  135.     #error /*    NULL is undefined?    */
  136. #endif /* NULL */
  137.  
  138. /******************************************************************************
  139.  **                                                                             **
  140.  **                                    Objects                                     **
  141.  **                                                                             **
  142.  *****************************************************************************/
  143. /*
  144.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  145.  * deletion, duplication, and i/o methods.
  146.  */
  147. typedef long                             TQ3ObjectType;
  148. typedef struct OpaqueTQ3Object*         TQ3Object;
  149. /* */
  150. /*
  151.  * There are four subclasses of OBJECT:
  152.  *    an ELEMENT, which is data that is placed in a SET
  153.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  154.  *    VIEWs, which maintain state information for an image
  155.  *    a PICK, which used to query a VIEW
  156.  */
  157. typedef TQ3Object                         TQ3ElementObject;
  158. typedef TQ3Object                         TQ3SharedObject;
  159. typedef TQ3Object                         TQ3ViewObject;
  160. typedef TQ3Object                         TQ3PickObject;
  161. /*
  162.  * There are several types of SharedObjects:
  163.  *    RENDERERs, which paint to a drawContext
  164.  *    DRAWCONTEXTs, which are an interface to a device 
  165.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  166.  *    FILEs, which maintain state information for a metafile
  167.  *    SHAPEs, which affect the state of the View
  168.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  169.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  170.  *    TRACKERs, which represent a position and orientation in the user interface
  171.  *  STRINGs, which are abstractions of text string data.
  172.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  173.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  174.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  175.  */
  176. typedef TQ3SharedObject                 TQ3RendererObject;
  177. typedef TQ3SharedObject                 TQ3DrawContextObject;
  178. typedef TQ3SharedObject                 TQ3SetObject;
  179. typedef TQ3SharedObject                 TQ3FileObject;
  180. typedef TQ3SharedObject                 TQ3ShapeObject;
  181. typedef TQ3SharedObject                 TQ3ShapePartObject;
  182. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  183. typedef TQ3SharedObject                 TQ3TrackerObject;
  184. typedef TQ3SharedObject                 TQ3StringObject;
  185. typedef TQ3SharedObject                 TQ3StorageObject;
  186. typedef TQ3SharedObject                 TQ3TextureObject;
  187. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  188. /*
  189.  * There is one types of SET:
  190.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  191.  */
  192. typedef TQ3SetObject                     TQ3AttributeSet;
  193. /*
  194.  * There are many types of SHAPEs:
  195.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  196.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  197.  *    GROUPs, which may contain any number of SHARED OBJECTS
  198.  *    GEOMETRYs, which are representations of three-dimensional data
  199.  *    SHADERs, which affect how colors are drawn on a geometry
  200.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  201.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  202.  *    REFERENCEs, which are references to objects in FILEs
  203.  *  UNKNOWN, which hold unknown objects read from a metafile.
  204.  */
  205. typedef TQ3ShapeObject                     TQ3GroupObject;
  206. typedef TQ3ShapeObject                     TQ3GeometryObject;
  207. typedef TQ3ShapeObject                     TQ3ShaderObject;
  208. typedef TQ3ShapeObject                     TQ3StyleObject;
  209. typedef TQ3ShapeObject                     TQ3TransformObject;
  210. typedef TQ3ShapeObject                     TQ3LightObject;
  211. typedef TQ3ShapeObject                     TQ3CameraObject;
  212. typedef TQ3ShapeObject                     TQ3UnknownObject;
  213. typedef TQ3ShapeObject                     TQ3ReferenceObject;
  214. typedef TQ3ShapeObject                     TQ3StateOperatorObject;
  215. /*
  216.  * For now, there is only one type of SHAPEPARTs:
  217.  *    MESHPARTs, which describe some part of a mesh
  218.  */
  219. typedef TQ3ShapePartObject                 TQ3MeshPartObject;
  220. /*
  221.  * There are three types of MESHPARTs:
  222.  *    MESHFACEPARTs, which describe a face of a mesh
  223.  *    MESHEDGEPARTs, which describe a edge of a mesh
  224.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  225.  */
  226. typedef TQ3MeshPartObject                 TQ3MeshFacePartObject;
  227. typedef TQ3MeshPartObject                 TQ3MeshEdgePartObject;
  228. typedef TQ3MeshPartObject                 TQ3MeshVertexPartObject;
  229. /*
  230.  * A DISPLAY Group can be drawn to a view
  231.  */
  232. typedef TQ3GroupObject                     TQ3DisplayGroupObject;
  233. /*
  234.  * There are many types of SHADERs:
  235.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  236.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  237.  */
  238. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  239. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  240. /*
  241.  * A handle to an object in a group
  242.  */
  243. typedef struct OpaqueTQ3GroupPosition*     TQ3GroupPosition;
  244. /* 
  245.  * TQ3ObjectClassNameString is used for the class name of an object
  246.  */
  247. enum {
  248.     kQ3StringMaximumLength        = 1024
  249. };
  250.  
  251.  
  252.     typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  253.     
  254.     
  255. /******************************************************************************
  256.  **                                                                             **
  257.  **                            Client/Server Things                             **
  258.  **                                                                             **
  259.  *****************************************************************************/
  260. typedef void *                            TQ3ControllerRef;
  261. /******************************************************************************
  262.  **                                                                             **
  263.  **                            Flags and Switches                                 **
  264.  **                                                                             **
  265.  *****************************************************************************/
  266.  
  267. enum TQ3Boolean {
  268.     kQ3False                    = 0,
  269.     kQ3True                        = 1
  270. };
  271. typedef enum TQ3Boolean TQ3Boolean;
  272.  
  273.  
  274. enum TQ3Switch {
  275.     kQ3Off                        = 0,
  276.     kQ3On                        = 1
  277. };
  278. typedef enum TQ3Switch TQ3Switch;
  279.  
  280.  
  281. enum TQ3Status {
  282.     kQ3Failure                    = 0,
  283.     kQ3Success                    = 1
  284. };
  285. typedef enum TQ3Status TQ3Status;
  286.  
  287.  
  288. enum TQ3Axis {
  289.     kQ3AxisX                    = 0,
  290.     kQ3AxisY                    = 1,
  291.     kQ3AxisZ                    = 2
  292. };
  293. typedef enum TQ3Axis TQ3Axis;
  294.  
  295.  
  296. enum TQ3PixelType {
  297.     kQ3PixelTypeRGB32            = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8    */
  298.     kQ3PixelTypeARGB32            = 1,                            /* Alpha:8, R:8, G:8, B:8             */
  299.     kQ3PixelTypeRGB16            = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5    */
  300.     kQ3PixelTypeARGB16            = 3,                            /* Alpha:1, R:5, G:5, B:5             */
  301.     kQ3PixelTypeRGB16_565        = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5        */
  302.     kQ3PixelTypeRGB24            = 5                                /* Win32 only: 24 bits/pixel, R:8, G:8, B:8        */
  303. };
  304. typedef enum TQ3PixelType TQ3PixelType;
  305.  
  306.  
  307. enum TQ3Endian {
  308.     kQ3EndianBig                = 0,
  309.     kQ3EndianLittle                = 1
  310. };
  311. typedef enum TQ3Endian TQ3Endian;
  312.  
  313.  
  314. enum TQ3EndCapMasks {
  315.     kQ3EndCapNone                = 0,
  316.     kQ3EndCapMaskTop            = 1 << 0,
  317.     kQ3EndCapMaskBottom            = 1 << 1,
  318.     kQ3EndCapMaskInterior        = 1 << 2
  319. };
  320. typedef enum TQ3EndCapMasks TQ3EndCapMasks;
  321.  
  322. typedef unsigned long                     TQ3EndCap;
  323.  
  324.     enum {
  325.         kQ3ArrayIndexNULL = ~0    
  326.     };
  327.     
  328.     
  329. /******************************************************************************
  330.  **                                                                             **
  331.  **                        Point and Vector Definitions                         **
  332.  **                                                                             **
  333.  *****************************************************************************/
  334.  
  335. struct TQ3Vector2D {
  336.     float                             x;
  337.     float                             y;
  338. };
  339. typedef struct TQ3Vector2D                TQ3Vector2D;
  340.  
  341. struct TQ3Vector3D {
  342.     float                             x;
  343.     float                             y;
  344.     float                             z;
  345. };
  346. typedef struct TQ3Vector3D                TQ3Vector3D;
  347.  
  348. struct TQ3Point2D {
  349.     float                             x;
  350.     float                             y;
  351. };
  352. typedef struct TQ3Point2D                TQ3Point2D;
  353.  
  354. struct TQ3Point3D {
  355.     float                             x;
  356.     float                             y;
  357.     float                             z;
  358. };
  359. typedef struct TQ3Point3D                TQ3Point3D;
  360.  
  361. struct TQ3RationalPoint4D {
  362.     float                             x;
  363.     float                             y;
  364.     float                             z;
  365.     float                             w;
  366. };
  367. typedef struct TQ3RationalPoint4D        TQ3RationalPoint4D;
  368.  
  369. struct TQ3RationalPoint3D {
  370.     float                             x;
  371.     float                             y;
  372.     float                             w;
  373. };
  374. typedef struct TQ3RationalPoint3D        TQ3RationalPoint3D;
  375. /******************************************************************************
  376.  **                                                                             **
  377.  **                                Quaternion                                     **
  378.  **                                                                             **
  379.  *****************************************************************************/
  380.  
  381. struct TQ3Quaternion {
  382.     float                             w;
  383.     float                             x;
  384.     float                             y;
  385.     float                             z;
  386. };
  387. typedef struct TQ3Quaternion            TQ3Quaternion;
  388. /******************************************************************************
  389.  **                                                                             **
  390.  **                                Ray Definition                                 **
  391.  **                                                                             **
  392.  *****************************************************************************/
  393.  
  394. struct TQ3Ray3D {
  395.     TQ3Point3D                         origin;
  396.     TQ3Vector3D                     direction;
  397. };
  398. typedef struct TQ3Ray3D                    TQ3Ray3D;
  399. /******************************************************************************
  400.  **                                                                             **
  401.  **                        Parameterization Data Structures                     **
  402.  **                                                                             **
  403.  *****************************************************************************/
  404.  
  405. struct TQ3Param2D {
  406.     float                             u;
  407.     float                             v;
  408. };
  409. typedef struct TQ3Param2D                TQ3Param2D;
  410.  
  411. struct TQ3Param3D {
  412.     float                             u;
  413.     float                             v;
  414.     float                             w;
  415. };
  416. typedef struct TQ3Param3D                TQ3Param3D;
  417.  
  418. struct TQ3Tangent2D {
  419.     TQ3Vector3D                     uTangent;
  420.     TQ3Vector3D                     vTangent;
  421. };
  422. typedef struct TQ3Tangent2D                TQ3Tangent2D;
  423.  
  424. struct TQ3Tangent3D {
  425.     TQ3Vector3D                     uTangent;
  426.     TQ3Vector3D                     vTangent;
  427.     TQ3Vector3D                     wTangent;
  428. };
  429. typedef struct TQ3Tangent3D                TQ3Tangent3D;
  430. /******************************************************************************
  431.  **                                                                             **
  432.  **                        Polar and Spherical Coordinates                         **
  433.  **                                                                             **
  434.  *****************************************************************************/
  435.  
  436. struct TQ3PolarPoint {
  437.     float                             r;
  438.     float                             theta;
  439. };
  440. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  441.  
  442. struct TQ3SphericalPoint {
  443.     float                             rho;
  444.     float                             theta;
  445.     float                             phi;
  446. };
  447. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  448. /******************************************************************************
  449.  **                                                                             **
  450.  **                            Color Definition                                 **
  451.  **                                                                             **
  452.  *****************************************************************************/
  453.  
  454. struct TQ3ColorRGB {
  455.     float                             r;
  456.     float                             g;
  457.     float                             b;
  458. };
  459. typedef struct TQ3ColorRGB                TQ3ColorRGB;
  460.  
  461. struct TQ3ColorARGB {
  462.     float                             a;
  463.     float                             r;
  464.     float                             g;
  465.     float                             b;
  466. };
  467. typedef struct TQ3ColorARGB                TQ3ColorARGB;
  468. /******************************************************************************
  469.  **                                                                             **
  470.  **                                    Vertices                                 **
  471.  **                                                                             **
  472.  *****************************************************************************/
  473.  
  474. struct TQ3Vertex3D {
  475.     TQ3Point3D                         point;
  476.     TQ3AttributeSet                 attributeSet;
  477. };
  478. typedef struct TQ3Vertex3D                TQ3Vertex3D;
  479. /******************************************************************************
  480.  **                                                                             **
  481.  **                                    Matrices                                 **
  482.  **                                                                             **
  483.  *****************************************************************************/
  484.  
  485. struct TQ3Matrix3x3 {
  486.     float                             value[3][3];
  487. };
  488. typedef struct TQ3Matrix3x3                TQ3Matrix3x3;
  489.  
  490. struct TQ3Matrix4x4 {
  491.     float                             value[4][4];
  492. };
  493. typedef struct TQ3Matrix4x4                TQ3Matrix4x4;
  494. /******************************************************************************
  495.  **                                                                             **
  496.  **                                Bitmap/Pixmap                                 **
  497.  **                                                                             **
  498.  *****************************************************************************/
  499.  
  500. struct TQ3Pixmap {
  501.     void *                            image;
  502.     unsigned long                     width;
  503.     unsigned long                     height;
  504.     unsigned long                     rowBytes;
  505.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  506.     TQ3PixelType                     pixelType;
  507.     TQ3Endian                         bitOrder;
  508.     TQ3Endian                         byteOrder;
  509. };
  510. typedef struct TQ3Pixmap                TQ3Pixmap;
  511.  
  512. struct TQ3StoragePixmap {
  513.     TQ3StorageObject                 image;
  514.     unsigned long                     width;
  515.     unsigned long                     height;
  516.     unsigned long                     rowBytes;
  517.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  518.     TQ3PixelType                     pixelType;
  519.     TQ3Endian                         bitOrder;
  520.     TQ3Endian                         byteOrder;
  521. };
  522. typedef struct TQ3StoragePixmap            TQ3StoragePixmap;
  523.  
  524. struct TQ3Bitmap {
  525.     unsigned char *                    image;
  526.     unsigned long                     width;
  527.     unsigned long                     height;
  528.     unsigned long                     rowBytes;
  529.     TQ3Endian                         bitOrder;
  530. };
  531. typedef struct TQ3Bitmap                TQ3Bitmap;
  532.  
  533. struct TQ3MipmapImage {                                            /* An image for use as a texture mipmap  */
  534.     unsigned long                     width;                        /* Width of mipmap, must be power of 2   */
  535.     unsigned long                     height;                        /* Height of mipmap, must be power of 2  */
  536.     unsigned long                     rowBytes;                    /* Rowbytes of mipmap                    */
  537.     unsigned long                     offset;                        /* Offset from image base to this mipmap */
  538. };
  539. typedef struct TQ3MipmapImage            TQ3MipmapImage;
  540.  
  541. struct TQ3Mipmap {
  542.     TQ3StorageObject                 image;                        /* Data containing the texture map and      */
  543.                                                                 /* if (useMipmapping==kQ3True) the          */
  544.                                                                 /* mipmap data                              */
  545.     TQ3Boolean                         useMipmapping;                /* True if mipmapping should be used      */
  546.                                                                 /* and all mipmaps have been provided    */
  547.     TQ3PixelType                     pixelType;
  548.     TQ3Endian                         bitOrder;
  549.     TQ3Endian                         byteOrder;
  550.     unsigned long                     reserved;                    /* leave NULL for next version             */
  551.     TQ3MipmapImage                     mipmaps[32];                /* The actual number of mipmaps is determined from the size of the first mipmap */
  552. };
  553. typedef struct TQ3Mipmap                TQ3Mipmap;
  554.  
  555.  
  556.  
  557. struct TQ3CompressedPixmap {
  558.     TQ3StorageObject                 compressedImage;            /* storage obj containing compressed image data */
  559.  
  560.     TQ3Endian                         imageDescByteOrder;            /* endianness of the data in the imageDesc */
  561.     TQ3StorageObject                 imageDesc;                    /* storage obj containing image description created by Quicktime to store info about compressed image */
  562.  
  563.     TQ3Boolean                         makeMipmaps;
  564.  
  565.     unsigned long                     width;
  566.     unsigned long                     height;
  567.     unsigned long                     pixelSize;
  568.     TQ3PixelType                     pixelType;
  569. };
  570. typedef struct TQ3CompressedPixmap        TQ3CompressedPixmap;
  571.  
  572. /******************************************************************************
  573.  **                                                                             **
  574.  **                        Higher dimension quantities                             **
  575.  **                                                                             **
  576.  *****************************************************************************/
  577.  
  578. struct TQ3Area {
  579.     TQ3Point2D                         min;
  580.     TQ3Point2D                         max;
  581. };
  582. typedef struct TQ3Area                    TQ3Area;
  583.  
  584. struct TQ3PlaneEquation {
  585.     TQ3Vector3D                     normal;
  586.     float                             constant;
  587. };
  588. typedef struct TQ3PlaneEquation            TQ3PlaneEquation;
  589.  
  590. struct TQ3BoundingBox {
  591.     TQ3Point3D                         min;
  592.     TQ3Point3D                         max;
  593.     TQ3Boolean                         isEmpty;
  594. };
  595. typedef struct TQ3BoundingBox            TQ3BoundingBox;
  596.  
  597. struct TQ3BoundingSphere {
  598.     TQ3Point3D                         origin;
  599.     float                             radius;
  600.     TQ3Boolean                         isEmpty;
  601. };
  602. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  603. /*
  604.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  605.  *    calls in the View. It's a hint to the system as to how it should 
  606.  *    compute the bbox of a shape:
  607.  *
  608.  *    kQ3ComputeBoundsExact:    
  609.  *        Vertices of shapes are transformed into world space and
  610.  *        the world space bounding box is computed from them.  Slow!
  611.  *    
  612.  *    kQ3ComputeBoundsApproximate: 
  613.  *        A local space bounding box is computed from a shape's
  614.  *        vertices.  This bbox is then transformed into world space,
  615.  *        and its bounding box is taken as the shape's approximate
  616.  *        bbox.  Fast but the bbox is larger than optimal.
  617.  */
  618.  
  619. enum TQ3ComputeBounds {
  620.     kQ3ComputeBoundsExact        = 0,
  621.     kQ3ComputeBoundsApproximate    = 1
  622. };
  623. typedef enum TQ3ComputeBounds TQ3ComputeBounds;
  624.  
  625.  
  626. /******************************************************************************
  627.  **                                                                             **
  628.  **                            Object System Types                                 **
  629.  **                                                                             **
  630.  *****************************************************************************/
  631.  
  632. typedef struct OpaqueTQ3XObjectClass*     TQ3XObjectClass;
  633.  
  634. typedef unsigned long                     TQ3XMethodType;
  635. /*
  636.  * Object methods
  637.  */
  638. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  639. /* 
  640.  *  Return true from the metahandler if this 
  641.  *  object can be submitted in a rendering loop 
  642.  */
  643. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    /* return true from the metahandler if this object can be submitted in a rendering loop */
  644. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  645. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  646. /*
  647.  * MetaHandler:
  648.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  649.  *        times to build method tables, and then is thrown away. You are 
  650.  *        guaranteed that your metahandler will never be called again after a 
  651.  *        call that was passed a metahandler returns.
  652.  *
  653.  *        Your metahandler should contain a switch on the methodType passed to it
  654.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  655.  *
  656.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  657.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  658.  *
  659.  *        These types here are prototypes of how your functions should look.
  660.  */
  661. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  662. /*
  663.  * See QD3DIO.h for the IO method types: 
  664.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  665.  */
  666.  
  667. /******************************************************************************
  668.  **                                                                             **
  669.  **                                Set Types                                     **
  670.  **                                                                             **
  671.  *****************************************************************************/
  672. typedef long                             TQ3ElementType;
  673. enum {
  674.     kQ3ElementTypeNone            = 0,
  675.     kQ3ElementTypeUnknown        = 32,
  676.     kQ3ElementTypeSet            = 33
  677. };
  678.  
  679.  
  680. /* 
  681.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  682.  *    
  683.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  684.  *        
  685.  *        Note that the object is always referenced when copying around. 
  686.  *        
  687.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  688.  *        group of other "objects" which have been found in the metafile and
  689.  *        have no attachment method to their parent. Be prepared to handle
  690.  *        any or all of these cases if you actually access the set on a shape.
  691.  *
  692.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  693.  *    
  694.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  695.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  696.  *            
  697.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  698.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  699.  *    
  700.  *        Note that the object is always referenced when copying around. 
  701.  *        
  702.  *    See the note below about the Set and Shape changes.
  703.  */
  704.  
  705. /******************************************************************************
  706.  **                                                                             **
  707.  **                            Object System Macros                             **
  708.  **                                                                             **
  709.  *****************************************************************************/
  710.  
  711. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  712.             ((const unsigned long)                     \
  713.             ((const unsigned long) (a) << 24) |     \
  714.             ((const unsigned long) (b) << 16) |        \
  715.             ((const unsigned long) (c) << 8)  |     \
  716.             ((const unsigned long) (d)))
  717.  
  718. #define Q3_OBJECT_TYPE(a,b,c,d) \
  719.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  720.  
  721. #define Q3_METHOD_TYPE(a,b,c,d) \
  722.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  723.  
  724. /******************************************************************************
  725.  **                                                                             **
  726.  **                                Object Types                                 **
  727.  **                                                                             **
  728.  *****************************************************************************/
  729. /*
  730.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  731.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  732.  */
  733.  
  734. #define kQ3ObjectTypeInvalid                            0L
  735. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  736. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  737.     #define kQ3ElementTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  738. #define kQ3ObjectTypePick                                ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  739.     #define kQ3PickTypeWindowPoint                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  740.     #define kQ3PickTypeWindowRect                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  741.     #define kQ3PickTypeWorldRay                            ((TQ3ObjectType)FOUR_CHAR_CODE('pkry'))
  742. #define kQ3ObjectTypeShared                                ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  743.     #define kQ3SharedTypeRenderer                        ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  744.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  745.         #define kQ3RendererTypeGeneric                    ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  746.         #define kQ3RendererTypeInteractive                ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  747.     #define kQ3SharedTypeShape                            ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  748.  
  749.             
  750.         #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  751.             #define kQ3GeometryTypeBox                    ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  752.             #define kQ3GeometryTypeGeneralPolygon        ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  753.             #define kQ3GeometryTypeLine                    ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  754.             #define kQ3GeometryTypeMarker                ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  755.             #define kQ3GeometryTypePixmapMarker            ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  756.             #define kQ3GeometryTypeMesh                    ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  757.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  758.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  759.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  760.             #define kQ3GeometryTypePolygon                ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  761.             #define kQ3GeometryTypePolyLine                ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  762.             #define kQ3GeometryTypeTriangle                ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  763.             #define kQ3GeometryTypeTriGrid                ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  764.             #define kQ3GeometryTypeCone                    ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  765.             #define kQ3GeometryTypeCylinder                ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  766.             #define kQ3GeometryTypeDisk                    ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  767.             #define kQ3GeometryTypeEllipse                ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  768.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  769.             #define kQ3GeometryTypePolyhedron            ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  770.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  771.             #define kQ3GeometryTypeTriMesh                ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  772.  
  773.             
  774.         #define kQ3ShapeTypeShader                        ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  775.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  776.                 #define kQ3SurfaceShaderTypeTexture        ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  777.             #define kQ3ShaderTypeIllumination            ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  778.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  779.                 #define kQ3IlluminationTypeLambert        ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  780.                 #define kQ3IlluminationTypeNULL            ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  781.         #define kQ3ShapeTypeStyle                        ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  782.             #define kQ3StyleTypeBackfacing                ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  783.             #define kQ3StyleTypeInterpolation            ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  784.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  785.             #define kQ3StyleTypePickID                    ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  786.             #define kQ3StyleTypeReceiveShadows            ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  787.             #define kQ3StyleTypeHighlight                ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  788.             #define kQ3StyleTypeSubdivision                ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  789.             #define kQ3StyleTypeOrientation                ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  790.             #define kQ3StyleTypePickParts                ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  791.             #define kQ3StyleTypeAntiAlias                ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  792.             #define kQ3StyleTypeFog                        ((TQ3ObjectType)FOUR_CHAR_CODE('fogg'))
  793.  
  794.             
  795.         #define kQ3ShapeTypeTransform                    ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  796.             #define kQ3TransformTypeMatrix                ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  797.             #define kQ3TransformTypeScale                ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  798.             #define kQ3TransformTypeTranslate            ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  799.             #define kQ3TransformTypeRotate                ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  800.             #define kQ3TransformTypeRotateAboutPoint     ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  801.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  802.             #define kQ3TransformTypeQuaternion            ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  803.             #define kQ3TransformTypeReset                ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  804.         #define kQ3ShapeTypeLight                        ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  805.             #define kQ3LightTypeAmbient                    ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  806.             #define kQ3LightTypeDirectional                ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  807.             #define kQ3LightTypePoint                    ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  808.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  809.  
  810.             
  811.         #define kQ3ShapeTypeCamera                        ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  812.             #define kQ3CameraTypeOrthographic            ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  813.             #define kQ3CameraTypeViewPlane                ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  814.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  815.         #define kQ3ShapeTypeStateOperator                ((TQ3ObjectType)FOUR_CHAR_CODE('stop'))
  816.             #define kQ3StateOperatorTypePush            ((TQ3ObjectType)FOUR_CHAR_CODE('push'))
  817.             #define kQ3StateOperatorTypePop             ((TQ3ObjectType)FOUR_CHAR_CODE('pop '))
  818.         #define kQ3ShapeTypeGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  819.             #define kQ3GroupTypeDisplay                    ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  820.                 #define kQ3DisplayGroupTypeOrdered        ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  821.                 #define kQ3DisplayGroupTypeIOProxy        ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  822.             #define kQ3GroupTypeLight                    ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  823.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  824.  
  825.             
  826.         #define kQ3ShapeTypeUnknown                        ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  827.             #define kQ3UnknownTypeText                    ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  828.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  829.         #define kQ3ShapeTypeReference                    ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  830.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  831.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  832.         #define kQ3SetTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  833.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  834.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  835.         #define kQ3DrawContextTypeMacintosh                ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  836.         #define kQ3DrawContextTypeWin32DC                ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  837.         #define kQ3DrawContextTypeDDSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  838.         #define kQ3DrawContextTypeX11                    ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  839.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  840.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm'))    
  841.         #define kQ3TextureTypeMipmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txmm'))    
  842.         #define kQ3TextureTypeCompressedPixmap            ((TQ3ObjectType)FOUR_CHAR_CODE('txcp'))
  843.  
  844.             
  845.     #define kQ3SharedTypeFile                            ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  846.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  847.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  848.         #define kQ3MemoryStorageTypeHandle                ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  849.         #define kQ3StorageTypeUnix                        ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  850.         #define kQ3UnixStorageTypePath                    ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  851.         #define kQ3StorageTypeMacintosh                    ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  852.         #define kQ3MacintoshStorageTypeFSSpec            ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                    
  853.         #define kQ3StorageTypeWin32                        ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  854.     #define kQ3SharedTypeString                            ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  855.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  856.     #define kQ3SharedTypeShapePart                        ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  857.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  858.             #define kQ3MeshPartTypeMeshFacePart            ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  859.             #define kQ3MeshPartTypeMeshEdgePart            ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  860.             #define kQ3MeshPartTypeMeshVertexPart        ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  861.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  862.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  863.     #define kQ3SharedTypeViewHints                        ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  864.     #define kQ3SharedTypeEndGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  865.  
  866. /******************************************************************************
  867.  **                                                                             **
  868.  **                            QuickDraw 3D System Routines                     **
  869.  **                                                                             **
  870.  *****************************************************************************/
  871. EXTERN_API_C( TQ3Status )
  872. Q3Initialize                    (void);
  873.  
  874. EXTERN_API_C( TQ3Status )
  875. Q3Exit                            (void);
  876.  
  877. EXTERN_API_C( TQ3Boolean )
  878. Q3IsInitialized                    (void);
  879.  
  880. EXTERN_API_C( TQ3Status )
  881. Q3GetVersion                    (unsigned long *        majorRevision,
  882.                                  unsigned long *        minorRevision);
  883.  
  884. /*
  885.  *  Q3GetReleaseVersion returns the release version number,
  886.  *  in the format of the first four bytes of a 'vers' resource
  887.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  888.  */
  889. EXTERN_API_C( TQ3Status )
  890. Q3GetReleaseVersion                (unsigned long *        releaseRevision);
  891.  
  892.  
  893. /******************************************************************************
  894.  **                                                                             **
  895.  **                            ObjectClass Routines                             **
  896.  **                                                                             **
  897.  *****************************************************************************/
  898. /* 
  899.  *  New object system calls to query the object system.
  900.  *
  901.  *  These comments to move to the stubs file before final release, they 
  902.  *  are here for documentation for developers using early seeds.
  903.  */
  904. /*
  905.  *  Given a class name as a string return the associated class type for the 
  906.  *  class, may return kQ3Failure if the string representing the class is 
  907.  *  invalid.
  908.  */
  909. EXTERN_API_C( TQ3Status )
  910. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  911.                                  TQ3ObjectType *        objectClassType);
  912.  
  913. /*
  914.  *  Given a class type as return the associated string for the class name, 
  915.  *  may return kQ3Failure if the type representing the class is invalid.
  916.  */
  917. EXTERN_API_C( TQ3Status )
  918. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType         objectClassType,
  919.                                  TQ3ObjectClassNameString  objectClassString);
  920.  
  921. /* 
  922.  *  Return true if the class with this type is registered, false if not 
  923.  */
  924. EXTERN_API_C( TQ3Boolean )
  925. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType         objectClassType);
  926.  
  927. /* 
  928.  *  Return true if the class with this name is registered, false if not 
  929.  */
  930. EXTERN_API_C( TQ3Boolean )
  931. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  932.  
  933. /*
  934.  * TQ3SubClassData is used when querying the object system for
  935.  * the subclasses of a particular parent type:
  936.  */
  937.  
  938. struct TQ3SubClassData {
  939.     unsigned long                     numClasses;                    /* the # of subclass types found for a parent class */
  940.     TQ3ObjectType *                    classTypes;                    /* an array containing the class types */
  941. };
  942. typedef struct TQ3SubClassData            TQ3SubClassData;
  943. /*
  944.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  945.  *  it in with the number and class types of all of the subclasses immediately
  946.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  947.  *  errors occurred, else kQ3Failure.
  948.  *
  949.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  950.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  951.  */
  952. EXTERN_API_C( TQ3Status )
  953. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType         objectClassType,
  954.                                  TQ3SubClassData *        subClassData);
  955.  
  956. /*
  957.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  958.  *    by the Q3ObjectClass_GetSubClassData call.
  959.  *
  960.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  961.  *  to avoid memory leaks.
  962.  */
  963. EXTERN_API_C( TQ3Status )
  964. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *    subClassData);
  965.  
  966.  
  967. /******************************************************************************
  968.  **                                                                             **
  969.  **                                Object Routines                                 **
  970.  **                                                                             **
  971.  *****************************************************************************/
  972. EXTERN_API_C( TQ3Status )
  973. Q3Object_Dispose                (TQ3Object                 object);
  974.  
  975. EXTERN_API_C( TQ3Object )
  976. Q3Object_Duplicate                (TQ3Object                 object);
  977.  
  978. EXTERN_API_C( TQ3Status )
  979. Q3Object_Submit                    (TQ3Object                 object,
  980.                                  TQ3ViewObject             view);
  981.  
  982. EXTERN_API_C( TQ3Boolean )
  983. Q3Object_IsDrawable                (TQ3Object                 object);
  984.  
  985. EXTERN_API_C( TQ3Boolean )
  986. Q3Object_IsWritable                (TQ3Object                 object,
  987.                                  TQ3FileObject             theFile);
  988.  
  989.  
  990. /******************************************************************************
  991.  **                                                                             **
  992.  **                            Object Type Routines                             **
  993.  **                                                                             **
  994.  *****************************************************************************/
  995. EXTERN_API_C( TQ3ObjectType )
  996. Q3Object_GetType                (TQ3Object                 object);
  997.  
  998. EXTERN_API_C( TQ3ObjectType )
  999. Q3Object_GetLeafType            (TQ3Object                 object);
  1000.  
  1001. EXTERN_API_C( TQ3Boolean )
  1002. Q3Object_IsType                    (TQ3Object                 object,
  1003.                                  TQ3ObjectType             theType);
  1004.  
  1005.  
  1006. /******************************************************************************
  1007.  **                                                                             **
  1008.  **                            Shared Object Routines                             **
  1009.  **                                                                             **
  1010.  *****************************************************************************/
  1011. EXTERN_API_C( TQ3ObjectType )
  1012. Q3Shared_GetType                (TQ3SharedObject         sharedObject);
  1013.  
  1014. EXTERN_API_C( TQ3SharedObject )
  1015. Q3Shared_GetReference            (TQ3SharedObject         sharedObject);
  1016.  
  1017. /* 
  1018.  *    Q3Shared_IsReferenced
  1019.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1020.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1021.  *    
  1022.  *    This call is intended to allow applications and plug-in objects to delete
  1023.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1024.  *    caching objects, etc.
  1025.  *    
  1026.  *    Although many may be tempted, DO NOT DO THIS:
  1027.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1028.  *    
  1029.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1030.  *    never fun (unless you short the stock). Thanks.
  1031.  */
  1032. EXTERN_API_C( TQ3Boolean )
  1033. Q3Shared_IsReferenced            (TQ3SharedObject         sharedObject);
  1034.  
  1035. /*
  1036.  *    Q3Shared_GetEditIndex
  1037.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1038.  *        object information. Returns 0 on error.
  1039.  *        
  1040.  *        Hold onto this number to determine if an object has changed since you
  1041.  *        last built your caches... To validate, do:
  1042.  *        
  1043.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1044.  *            // Cache is valid
  1045.  *        } else {
  1046.  *            // Cache is invalid
  1047.  *            RebuildSomeSortOfCache(foo);
  1048.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1049.  *        }
  1050.  */
  1051. EXTERN_API_C( unsigned long )
  1052. Q3Shared_GetEditIndex            (TQ3SharedObject         sharedObject);
  1053.  
  1054. /*
  1055.  *    Q3Shared_Edited
  1056.  *        Bumps the "serial number" of sharedObject to a different value. This
  1057.  *        call is intended to be used solely from a plug-in object which is 
  1058.  *        shared. Call this whenever your private instance data changes.
  1059.  *        
  1060.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1061.  *            QuickDraw 3D isn't initialized.
  1062.  */
  1063. EXTERN_API_C( TQ3Status )
  1064. Q3Shared_Edited                    (TQ3SharedObject         sharedObject);
  1065.  
  1066.  
  1067. /******************************************************************************
  1068.  **                                                                             **
  1069.  **                                Shape Routines                                 **
  1070.  **                                                                             **
  1071.  *****************************************************************************/
  1072. /*
  1073.  *    QuickDraw 3D 1.5 Note:
  1074.  *
  1075.  *    Shapes and Sets are now (sort of) polymorphic.
  1076.  *
  1077.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1078.  *        The following calls are identical, in implementation:
  1079.  *
  1080.  *            Q3Shape_GetElement            =    Q3Set_Get
  1081.  *            Q3Shape_AddElement            =    Q3Set_Add
  1082.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1083.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1084.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1085.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1086.  *
  1087.  *    All of these calls accept a shape or a set as their first parameter.
  1088.  *
  1089.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1090.  *    element type kQ3ElementTypeSet. See the note above about 
  1091.  *    kQ3ElementTypeSet;
  1092.  *
  1093.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1094.  *    create a set on a shape and then add the element to it. This data is
  1095.  *    attached directly to the shape. Therefore, it is possible for an element
  1096.  *    to exist on a shape without a set existing on it as well. 
  1097.  *
  1098.  *    In your application, if you attach an element to a shape like this:
  1099.  *        (this isn't checking for errors for simplicity)
  1100.  *
  1101.  *        set = Q3Set_New();
  1102.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1103.  *        Q3Shape_SetSet(shape, set);
  1104.  *
  1105.  *    You should retrieve it in the same manner:
  1106.  *
  1107.  *        Q3Shape_GetSet(shape, &set);
  1108.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1109.  *            Q3Set_Get(set, kMyElemType, &data);
  1110.  *        }
  1111.  *
  1112.  *    Similarly, if you attach data to a shape with the new calls:
  1113.  *
  1114.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1115.  *
  1116.  *    You should retrieve it in the same manner:
  1117.  *
  1118.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1119.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1120.  *        }
  1121.  *
  1122.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1123.  *    metafiles.
  1124.  *
  1125.  *    When attempting to find a particular element on a shape, you should
  1126.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1127.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1128.  *    and then Q3Shape_GetElement(set, ...).
  1129.  *
  1130.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1131.  *    used for sets of information that are shared among multiple shapes.
  1132.  *    
  1133.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1134.  *    for elements that are unique for a particular shape.
  1135.  *    
  1136.  */
  1137. EXTERN_API_C( TQ3ObjectType )
  1138. Q3Shape_GetType                    (TQ3ShapeObject         shape);
  1139.  
  1140. EXTERN_API_C( TQ3Status )
  1141. Q3Shape_GetSet                    (TQ3ShapeObject         shape,
  1142.                                  TQ3SetObject *            theSet);
  1143.  
  1144. EXTERN_API_C( TQ3Status )
  1145. Q3Shape_SetSet                    (TQ3ShapeObject         shape,
  1146.                                  TQ3SetObject             theSet);
  1147.  
  1148. EXTERN_API_C( TQ3Status )
  1149. Q3Shape_AddElement                (TQ3ShapeObject         shape,
  1150.                                  TQ3ElementType         theType,
  1151.                                  const void *            data);
  1152.  
  1153. EXTERN_API_C( TQ3Status )
  1154. Q3Shape_GetElement                (TQ3ShapeObject         shape,
  1155.                                  TQ3ElementType         theType,
  1156.                                  void *                    data);
  1157.  
  1158. EXTERN_API_C( TQ3Boolean )
  1159. Q3Shape_ContainsElement            (TQ3ShapeObject         shape,
  1160.                                  TQ3ElementType         theType);
  1161.  
  1162. EXTERN_API_C( TQ3Status )
  1163. Q3Shape_GetNextElementType        (TQ3ShapeObject         shape,
  1164.                                  TQ3ElementType *        theType);
  1165.  
  1166. EXTERN_API_C( TQ3Status )
  1167. Q3Shape_EmptyElements            (TQ3ShapeObject         shape);
  1168.  
  1169. EXTERN_API_C( TQ3Status )
  1170. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1171.                                  TQ3ElementType         theType);
  1172.  
  1173.  
  1174. /******************************************************************************
  1175.  **                                                                             **
  1176.  **                            Color Table Routines                             **
  1177.  **                                                                             **
  1178.  *****************************************************************************/
  1179. EXTERN_API_C( TQ3Status )
  1180. Q3Bitmap_Empty                    (TQ3Bitmap *            bitmap);
  1181.  
  1182. EXTERN_API_C( unsigned long )
  1183. Q3Bitmap_GetImageSize            (unsigned long             width,
  1184.                                  unsigned long             height);
  1185.  
  1186.  
  1187.  
  1188.  
  1189. #if PRAGMA_ENUM_ALWAYSINT
  1190.     #pragma enumsalwaysint reset
  1191. #elif PRAGMA_ENUM_OPTIONS
  1192.     #pragma option enum=reset
  1193. #elif defined(PRAGMA_ENUM_PACK__QD3D__)
  1194.     #pragma options(pack_enums)
  1195. #endif
  1196.  
  1197. #if PRAGMA_STRUCT_ALIGN
  1198.     #pragma options align=reset
  1199. #elif PRAGMA_STRUCT_PACKPUSH
  1200.     #pragma pack(pop)
  1201. #elif PRAGMA_STRUCT_PACK
  1202.     #pragma pack()
  1203. #endif
  1204.  
  1205. #ifdef PRAGMA_IMPORT_OFF
  1206. #pragma import off
  1207. #elif PRAGMA_IMPORT
  1208. #pragma import reset
  1209. #endif
  1210.  
  1211. #ifdef __cplusplus
  1212. }
  1213. #endif
  1214.  
  1215. #endif /* __QD3D__ */
  1216.  
  1217.